]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
croco: Use g_string_free() return value
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 2 Feb 2023 22:37:21 +0000 (23:37 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 3 Feb 2023 14:54:59 +0000 (14:54 +0000)
glib now warns if the return value is not used, so use the API as
intended instead of assigning the character data separately before
freeing the GString.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2625>

12 files changed:
src/st/croco/cr-additional-sel.c
src/st/croco/cr-attr-sel.c
src/st/croco/cr-declaration.c
src/st/croco/cr-fonts.c
src/st/croco/cr-parsing-location.c
src/st/croco/cr-pseudo.c
src/st/croco/cr-rgb.c
src/st/croco/cr-selector.c
src/st/croco/cr-simple-sel.c
src/st/croco/cr-statement.c
src/st/croco/cr-stylesheet.c
src/st/croco/cr-term.c

index 768ec75b66006a62f0e6e5c9bdf1d4602110b0fc..9bd8d6a7d0f18e91776e57e4cbb746ea6adeb47e 100644 (file)
@@ -323,8 +323,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
@@ -422,8 +421,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
index fbe8aa3183078b9afb4c7788bc04b345da69d6eb..fc8e6ef8094bccce6652ef66cf1b57c05c9ded44 100644 (file)
@@ -168,8 +168,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
         }
 
         return result;
index bf1bcc1cd02db3ffd9ef3cf0e791803f19552dbc..6c70128a256de94f1eac59ab50a181e16bdfb078 100644 (file)
@@ -539,8 +539,7 @@ cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent)
                 }
         }
         if (stringue && stringue->str) {
-                result = stringue->str;
-                g_string_free (stringue, FALSE);
+                result = g_string_free (stringue, FALSE);
         }
         return result;
 
@@ -586,8 +585,7 @@ cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent)
                         break;
         }
         if (stringue && stringue->str) {
-                result = (guchar *) stringue->str;
-                g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free (stringue, FALSE);
         }
 
         return result;
@@ -639,8 +637,7 @@ cr_declaration_list_to_string2 (CRDeclaration const * a_this,
                         break;
         }
         if (stringue && stringue->str) {
-                result = (guchar *) stringue->str;
-                g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free (stringue, FALSE);
         }
 
         return result;
index 7690d2ebd80890a9e1624f2c119522c8717ed0bc..a64ffc045b3e943acd6988fe611725fcb375673f 100644 (file)
@@ -196,8 +196,7 @@ cr_font_family_to_string (CRFontFamily const * a_this,
                                                 &stringue);
 
         if (status == CR_OK && stringue) {
-                result = (guchar *) stringue->str;
-                g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free (stringue, FALSE);
                 stringue = NULL;
 
         } else {
index 0aa0a45b309de014c97e1bdcb3c45b8fe897f60b..2b40974130fafb04a71f3575c86448a3c13156bd 100644 (file)
@@ -126,8 +126,7 @@ cr_parsing_location_to_string (CRParsingLocation const *a_this,
                                        a_this->byte_offset) ;
        }
        if (result->len) {
-               str = result->str ;
-               g_string_free (result, FALSE) ;
+               str = g_string_free (result, FALSE) ;
        } else {
                g_string_free (result, TRUE) ;
        }
index cee3fc86907850998e5aac97627e7e52613993f1..f81f9a6e6a3e8b8eff2f926038714012c91d7c6d 100644 (file)
@@ -107,8 +107,7 @@ cr_pseudo_to_string (CRPseudo const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
index 6ab97826c77b887d930a6f854c0001bac0abc39f..a2b478f7c1aa0c26cb4cf83395b70403292b50c2 100644 (file)
@@ -273,8 +273,7 @@ cr_rgb_to_string (CRRgb const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
         }
 
         return result;
index 8902e1c0f1f07a1e09d552a3b38927382e416164..c9aad4327287b572d4fcb72d06f191ab90ebc9f5 100644 (file)
@@ -171,8 +171,7 @@ cr_selector_to_string (CRSelector const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
index 7d7c42230300753d097b6df1fdbdfdf552498f70..bac862187db8370701da94319dcdb2ff1b1cfa9d 100644 (file)
@@ -152,8 +152,7 @@ cr_simple_sel_to_string (CRSimpleSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
@@ -194,8 +193,7 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
index 376617c60cb28eb7416e94783645495b51b4dc87..eaeb49f3514f30eb67d4650c485efddd0c7f7d46 100644 (file)
@@ -623,12 +623,8 @@ cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent)
                 cr_utils_dump_n_chars2 (' ', stringue, a_indent);
         }
         g_string_append (stringue, "}");
-        result = stringue->str;
+        result = g_string_free (stringue, FALSE);
 
-        if (stringue) {
-                g_string_free (stringue, FALSE);
-                stringue = NULL;
-        }
         if (tmp_str) {
                 g_free (tmp_str);
                 tmp_str = NULL;
@@ -679,8 +675,7 @@ cr_statement_font_face_rule_to_string (CRStatement const * a_this,
                 g_string_append (stringue, "\n}");
         }
         if (stringue) {
-                result = stringue->str ;
-                g_string_free (stringue, FALSE) ;
+                result = g_string_free (stringue, FALSE);
                 stringue = NULL ;
         }
         return result ;
@@ -726,8 +721,7 @@ cr_statement_charset_to_string (CRStatement const *a_this,
                 }
         }
         if (stringue) {
-                str = stringue->str ;
-                g_string_free (stringue, FALSE) ;
+                str = g_string_free (stringue, FALSE);
         }
         return str ;
 }
@@ -780,8 +774,7 @@ cr_statement_at_page_rule_to_string (CRStatement const *a_this,
                 }
                 g_string_append (stringue, "\n}\n");
         }
-        result = stringue->str ;
-        g_string_free (stringue, FALSE) ;
+        result = g_string_free (stringue, FALSE) ;
         stringue = NULL ;
         return result ;
 }
@@ -842,8 +835,7 @@ cr_statement_media_rule_to_string (CRStatement const *a_this,
                 g_string_append (stringue, "\n}");
         }
         if (stringue) {
-                str = stringue->str ;
-                g_string_free (stringue, FALSE) ;
+                str = g_string_free (stringue, FALSE) ;
         }
         return str ;
 }
@@ -903,8 +895,7 @@ cr_statement_import_rule_to_string (CRStatement const *a_this,
                 g_string_append (stringue, " ;");
         }
         if (stringue) {
-                str = stringue->str ;
-                g_string_free (stringue, FALSE) ;
+                str = g_string_free (stringue, FALSE) ;
                 stringue = NULL ;
         }
         return str ;
@@ -2562,8 +2553,7 @@ cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
                         str = NULL ;
                 }                
         }
-        str = stringue->str ;
-        g_string_free (stringue, FALSE) ;
+        str = g_string_free (stringue, FALSE) ;
         return str ;
 }
 
index 69909da245caa33517ce460ab7eda813f661d8a7..63e763feb71f5874828a963496366949cf12488c 100644 (file)
@@ -82,8 +82,7 @@ cr_stylesheet_to_string (CRStyleSheet const *a_this)
                }
         }
        if (stringue) {
-               str = stringue->str ;
-               g_string_free (stringue, FALSE) ;
+               str = g_string_free (stringue, FALSE) ;
                stringue = NULL ;
        }
        return str ;
index 4235241938d3d4d79a5540d80b6f0d5666f73f5b..b527d954f879f1230dee98e9d61883d1d6dc3fcc 100644 (file)
@@ -462,8 +462,7 @@ cr_term_to_string (CRTerm const * a_this)
         }
 
         if (str_buf) {
-                result =(guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
 
@@ -657,8 +656,7 @@ cr_term_one_to_string (CRTerm const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) str_buf->str;
-                g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }